﻿namespace Interpreter
{
	public class Token
	{
		Token leftPart;
		public Token LeftPart
		{
			get { return leftPart; }
			set { leftPart = value; hasChildren = true; }
		}

		Token rightPart;
		public Token RightPart
		{
			get { return rightPart; }
			set { rightPart = value; hasChildren = true; }
		}

		string operatorString;
		public string OperatorString
		{
			get { return operatorString; }
			set { operatorString = value; }
		}

		private bool hasChildren = false;
		public bool HasChildren
		{
			get { return hasChildren; }
			set { hasChildren = value; }
		}

		public override string ToString()
		{
			if (!hasChildren)
			{
				return operatorString;
			}
			return leftPart.ToString() + " " + operatorString + " " + rightPart.ToString();
		}
	}
}
